import requests
from config import url, headers_web


class ExpertInformation:
    def __init__(self):
        self.url = url
        self.headers_web = headers_web

    @classmethod
    def get_online_experts(cls, url: str, params=None, headers=headers_web):
        """
        @Summary: 在线专家列表
        @Description: 云课堂管理端专家听课使用
        :param url: "http://192.168.1.32:8080/"
        :param params: {"validCode": "string" } #MD5加密验证字符串(&signKey=123123)
        :param headers: {
                          "Content-Type":"application/json",
                          "X-Requested-With":"XMLHttpRequest",
                          "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64)
                          AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36"
                        }
        :return: [{
                    "expertId": "string", #专家id
                    "expertName": "string", #专家姓名
                    "expertNo": "string", #专家编号
                    "listenTime": "string" #听课时间（yyyy-MM-dd HH:mm:ss）
                  }]
        """
        url_path = url + "/teachingApi/v1/experts/online"
        r = requests.get(url=url_path, params=params, headers=headers)
        return r
